/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */
package io.simple.core.chain;


import io.simple.core.RequestContext;
import io.simple.signals.Signal;

import java.nio.ByteBuffer;

/**
 * Filters can be used to pre-process or post-process requests
 *
 * @author Tom
 */
public interface Filter extends AutoCloseable {

    /**
     * Filter request - modifies request context, etc.
     * <p/>
     * This method is invoked on request arrival
     *
     * @param context
     * @throws Signal if filters interrupts further processing
     */
    public ByteBuffer filter(RequestContext context, ByteBuffer data) throws Signal;

}
